-- card: 4623 from stack: in. Update -- bmap block id: 4017 -- flags: 0000 -- background id: 3799 -- name: TheIndex ----- HyperTalk script ----- on openCard hide field 1 hide field 2 set lockText of card field 1 to true set lockText of card field 2 to true end openCard -- part 1 (field) -- low flags: 01 -- high flags: 0007 -- rect: left=76 top=96 right=312 bottom=264 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: finder ----- HyperTalk script ----- on mouseUp if the selection is empty then set lockText of the target to false repeat two times click at the clickLoc end repeat put the selection into holder get (item 2 of the clickLoc) - (item 2 of (the rect of the target)) add (the scroll of the target) to it put trunc(it / (the textHeight of the target)+0.5) into whichLine add 2 to whichLine get field keywords of card whichLine if (it = holder) then -- visual effect wipe right to black -- visual effect wipe left go card whichLine else -- visual effect wipe right to black -- visual effect wipe left find holder in field keywords -- This line is the link if the result is not empty then answer "No match for keyword " "e& holder"e go card 1 end if end if click at 0,0 --disable selection set lockText of the target to true end if end mouseUp -- part 27 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=356 top=75 right=96 bottom=458 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Add Keyword ----- HyperTalk script ----- on mouseUp ask "Enter New Keyword:" if it is not empty then put it into keyname -- The following code added 4/19/88 by Richard Clark -- Use a binary search to find the appropriate card and -- insert it in sorted order -- (note: this works best if the stack is in sorted order, -- however it should still work (after a fashion) if the -- stack is not sorted.) set the lockScreen to true put number of cards into upper_bound put 2 into lower_bound repeat put trunc((upper_bound + lower_bound) / 2) into probe get field keywords of card probe if (it = keyname) then go card probe answer "This card already exists" exit mouseUp -- the card already exists else if (it > keyname) then put probe into upper_bound else put probe into lower_bound end if if (upper_bound - lower_bound) <= 1 then exit repeat end if end repeat -- Adjust the insertion point to the card in front of where -- we want to be repeat while (it < keyname) if (probe = number of cards) then exit repeat add 1 to probe get field keywords of card probe end repeat repeat while (it >= keyname) subtract 1 from probe get field keywords of card probe end repeat -- and go to that card go card probe else -- the user reports that we aren't in sorted order go card 2 end if doMenu "New Card" set the name of this card to keyname put keyname into field keywords -- Now, update the index (and keep it in sorted order!) subtract 2 from probe get the number of lines in card field 1 of card "TheIndex" if (probe > it) then subtract it from probe put return & keyname after line probe of card field 2 of card "TheIndex" else put return & keyname after line probe of card field 1 of card "theIndex" end if end mouseUp -- part 40 (field) -- low flags: 01 -- high flags: 2007 -- rect: left=269 top=96 right=312 bottom=457 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: finder ----- HyperTalk script ----- on mouseUp if the selection is empty then set lockText of the target to false repeat two times click at the clickLoc end repeat put the selection into holder push card -- visual effect wipe right to black -- visual effect wipe left get (item 2 of the clickLoc) - (item 2 of (the rect of the target)) add (the scroll of the target) to it put trunc(it / (the textHeight of the target)+0.5) into whichLine add (number of lines in card field 1)+2 to whichLine get field keywords of card whichLine if (it = holder) then go card whichLine else find holder in field keywords -- This line is the link if the result is not empty then answer "No match for keyword " "e& holder"e pop card end if end if click at 0,0 --disable selection set lockText of the target to true end if end mouseUp -- part 42 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=76 top=73 right=94 bottom=178 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Re-Index ----- HyperTalk script ----- on mouseUp global holder global cardCount, numCards, nextSignal put the ticks into startTime set the LockScreen to true put empty into card field 1 put empty into card field 2 set the cursor to 4 play boing c5 put "Sorting Reference Cards . . . Please Wait" into message sort text by field 2 play boing d4 put "Getting Keywords . . . Please Wait" into message put number of cards into x put x into numCards -- If we have 13 or fewer cards, put all of them into the first -- index column if (numCards > 13) then put trunc(x/2 + 0.5) into a -- round up else put numCards into a end if put 25 into nextSignal put empty into holder repeat with cardCount = 3 to a get field 2 of card cardCount put it & return after holder if (cardCount >= nextSignal) then updateCount fixHolder put holder after card field 1 put empty into holder end if end repeat fixHolder put holder after card field 1 put empty into holder repeat with cardCount = a+1 to numCards get field 2 of card cardCount put it & return after holder if (cardCount >= nextSignal) then updateCount fixHolder put holder after card field 2 put empty into holder end if end repeat fixHolder put holder after card field 2 go card 1 put "Compacting Stack . . . Please Wait" into message -- doMenu "Compact Stack" put trunc((the ticks - startTime) / 60 + 0.5) into seconds if seconds < 60 then put "Done in" && seconds && "seconds" into message else put "Done in" && trunc(seconds / 60) && "minutes and " && (seconds mod 60) && "seconds" into message end if -- wait 2 seconds -- hide message end mouseUp on fixHolder -- Remove any blank lines from the index listing global holder repeat with l = 1 to number of lines in holder if (line l of holder is empty) then delete line l of holder end if end repeat end fixHolder on updateCount -- Update the displayed count and set up for the next update global cardCount, numCards, nextSignal put cardCount && "cards processed (out of" && numCards & ")" into message add 25 to nextSignal end updateCount -- part contents for background part 1 ----- text ----- -- part contents for background part 41 ----- text ----- What links to Patrick? -- part contents for card part 1 ----- text ----- Read Me First! Improvements… "Add Keywords" Cross-Referencing Installation Re-Indexing The Index Card